package com.example.demo;

import java.io.IOException;

/**
 * @author linjingze
 * @date 2023/12/16 10:54 上午
 */
public class OpenUtils {


    public static void open(String filePath) {
        try {
            if (isWindows()){
                Runtime.getRuntime().exec("explorer " + filePath );
            }else{
                Runtime.getRuntime().exec("open " + filePath);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static boolean isWindows() {
        return System.getProperties().getProperty("os.name").toUpperCase().indexOf("WINDOWS") != -1;
    }


}
